<!-- 项目收款合同申请 -->
<template>
	<view>
		<u-sticky>
			<u-tabs
				class="tabs"
				:list="tabsList"
				@click="onTabClick"
				:scrollable="true" style="padding: 0 24rpx;background: #FFF;z-index:22;position: sticky;top: 0px;"
				:activeStyle="{color:'#171717', fontSize: '14px'}"
				:inactiveStyle="{color:'#C6C6C6', fontSize: '14px'}"
				:itemStyle="{ whiteSpace:'nowrap',height: '44px' }"
				lineColor="#1E6FFF"
			></u-tabs>
		</u-sticky>
		<view class="task_lists" :style="{ paddingBottom: tabvalue == '待办'?'130rpx':'0' }">
			<collapse name="基本信息" id="outside1" :maxHeight="maxHeight">
				<view class="listdefault" :id="uId">
					<view class="action" v-for="(item,key) in basicInfo" :key="key">
						<view class="list1">{{ key }}</view>
						<view class="list2">{{ detailData[item] }}</view>
					</view>
					<view class="action" v-if="detailData.lx =='2'">
						<view class="list1">合同编号</view>
						<view class="list2">{{ detailData.caId_dictText }}</view>
					</view>
					<view class="action">
						<view class="list1">合同名称</view>
						<view class="list2">{{ detailData.htmc }}</view>
					</view>
					<view class="action">
						<view class="list1">合同类型</view>
						<view class="list2">{{ detailData.htlx_dictText }}</view>
					</view>
					<view class="action" v-if="detailData.lx =='2'">
						<view class="list1">变更类型</view>
						<view class="list2">{{ detailData.bglx_dictText }}</view>
					</view>
					<view class="action" v-if="detailData.lx =='2' && detailData.bglx == '2'">
						<view class="list1">终止时间</view>
						<view class="list2">{{ detailData.stopTime }}</view>
					</view>
					<view class="action">
						<view class="list1">项目名称</view>
						<view class="list2">{{ detailData.xmmc_dictText }}</view>
					</view>
					<view class="action" v-if="detailData.isCategoryType ==1">
						<view class="list1">采购类型</view>
						<view class="list2">{{ detailData.provisionType_dictText }}</view>
					</view>
					<view class="action" v-if="detailData.isCategoryType ==1 && detailData.provisionType ==1">
						<view class="list1">关联单据</view>
						<view class="list2">{{ detailData.calibrationId_dictText }}</view>
					</view>
					<view class="action" v-if="detailData.isCategoryType ==1 && detailData.provisionType ==2">
						<view class="list1">关联单据</view>
						<view class="list2">{{ detailData.purchaseApplyId_dictText }}</view>
					</view>
					<view class="action" v-if="detailData.isCategoryType ==1 && detailData.provisionType ==3">
						<view class="list1">关联单据</view>
						<view class="list2">{{ detailData.invitationId_dictText }}</view>
					</view>
					<view class="action" v-if="detailData.htlx == 2 && detailData.feeType=='2'">
						<view class="list1">费用所属团队</view>
						<view class="list2">{{ detailData.jytd_dictText }}</view>
					</view>
					<view class="action" v-else>
						<view class="list1">经营团队</view>
						<view class="list2">{{ detailData.jytd_dictText }}</view>
					</view>
					<view class="action">
						<view class="list1">业绩归属年度</view>
						<view class="list2">{{ detailData.yjgsnd }}</view>
					</view>
					<view class="action">
						<view class="list1">签订单位</view>
						<view class="list2">{{ detailData.qddw_dictText }}</view>
					</view>
					<view class="action">
						<view class="list1">框架下合同</view>
						<view class="list2">{{ detailData.isFrameContract_dictText }}</view>
					</view>
					<view class="action" v-if="detailData.isFrameContract && detailData.isFrameContract == 'yes'">
						<view class="list1">关联框架合同</view>
						<view class="list2">{{ detailData.frameContractId_dictText }}</view>
					</view>
					<view class="action">
						<view class="list1">项目承接人</view>
						<view class="list2">{{ detailData.xmcjr_dictText }}</view>
					</view>
					<view class="action">
						<view class="list1">业主单位</view>
						<view class="list2">{{ detailData.yzdw_dictText }}</view>
					</view>
					<view class="action">
						<view class="list1">联系人</view>
						<view class="list2">{{ detailData.lxr_dictText }}</view>
					</view>
					<view class="action">
						<view class="list1">联系方式</view>
						<view class="list2">{{ detailData.lxfs }}</view>
					</view>
					<view class="action">
						<view class="list1">业主角色</view>
						<view class="list2">{{ detailData.ownerRole_dictText }}</view>
					</view>
					<view class="action">
						<view class="list1">企业类型</view>
						<view class="list2">{{ detailData.enterpriseType_dictText }}</view>
					</view>
					<view class="action">
						<view class="list1">签订日期</view>
						<view class="list2">{{ detailData.qdrq }}</view>
					</view>
					<view class="action">
						<view class="list1">服务期限</view>
						<view class="list2">{{ 
							!detailData.fwqx || !detailData.fwqxEnd?'--':detailData.fwqx+'~'+detailData.fwqxEnd }}</view>
					</view>
					<view class="action">
						<view class="list1">是否存档</view>
						<view class="list2">{{ detailData.sfcd_dictText }}</view>
					</view>
					<view class="action" v-if="detailData.sfcd==='1'">
						<view class="list1">合同存档份数</view>
						<view class="list2">{{ detailData.cdfs }}</view>
					</view>
					<view class="action" v-if="detailData.sfcd==='1'">
						<view class="list1">存档形式</view>
						<view class="list2">{{ detailData.contractFileType_dictText }}</view>
					</view>
				</view>
			</collapse>
			<template>
				<action-collapse name="委托方(合同甲方)信息" :childFields="childFields3" id="outside2" :dataSource="childSource2"></action-collapse>
			</template>
			<template>
				<action-collapse name="受托方(合同乙方)信息" :childFields="childFields2" id="outside3" :dataSource="childSource3"></action-collapse>
			</template>
			<collapse name="合同金额" id="outside7" :maxHeight="maxHeight7">
				<view class="listdefault" :id="uId7">
					<view class="action">
						<view class="list1">本次合同额(元)</view>
						<view class="list2">{{ detailData.bchte }}</view>
					</view>
					<view class="action">
						<view class="list1">本次合同额大写</view>
						<view class="list2">{{ detailData.bchtedx }}</view>
					</view>
					<view class="action">
						<view class="list1">经营绩效(元)</view>
						<view class="list2">{{ detailData.businessPerformance }}</view>
					</view>
				</view>
			</collapse>
			<action-collapse
				name="收付款计划"
				:childFields="childFields5"
				id="outside5"
				isShowBtn
				:dataSource="childSource5"
				@click="handleClick">
				<view slot="handler" style="margin: 0 20rpx; padding: 10rpx 0;" v-if="detailData.lx == '2'">
					<view class="action" style="border-bottom: 1px solid #e5e5e5; padding-bottom: 20rpx;">
						<view class="list1">是否变更款项信息</view>
						<view class="list2">{{ detailData.sfbgkxxx_dictText }}</view>
					</view>
				</view>
			</action-collapse>
			<view>
				<action-collapse
				name="任务信息列表"
				:childFields="childFields4"
				id="outside4"
				:dataSource="childSource4">
					<view slot="handler" style="margin: 0 20rpx; padding: 10rpx 0;">
						 <!-- style="border-bottom: 1px solid #e5e5e5; padding: 10rpx 0; margin: 0 20rpx" -->
						<view class="action">
							<view class="list1">分配方式</view>
							<view class="list2">{{ detailData.distributionMethod_dictText }}</view>
						</view>
						<view class="action" style="border-bottom: 1px solid #e5e5e5; padding-bottom: 20rpx;">
							<view class="list1">主生产团队</view>
							<view class="list2">{{ detailData.mainProductionTeam_dictText }}</view>
						</view>
					</view>
				</action-collapse>
			</view>
			<collapse name="合同金额" id="outside8" :maxHeight="maxHeight8">
				<view class="listdefault" :id="uId8">
					<view class="action">
						<view class="list1">是否用印</view>
						<view class="list2">{{ detailData.sfyz_dictText }}</view>
					</view>
					<template v-if="detailData.sfyz == '0'">
						<view class="action">
							<view class="list1">无正式合同</view>
							<view class="list2">{{ detailData.noFormalContract_dictText }}</view>
						</view>
					</template>
					<template v-if="detailData.sfyz == 1">
						<view class="action">
							<view class="list1">用印类型</view>
							<view class="list2">{{ detailData.signSealWay_dictText }}</view>
						</view>
						<view class="action">
							<view class="list1">印章类型</view>
							<view class="list2">{{ detailData.yzlx_dictText }}</view>
						</view>
						<view class="action">
							<view class="list1">用印份数</view>
							<view class="list2">{{ detailData.yyfs }}</view>
						</view>
					</template>
				</view>
			</collapse>
			<template>
				<action-collapse
					name="合同税率"
					:childFields="childFields9"
					id="outside9"
					:dataSource="childSource9"></action-collapse>
			</template>
			<collapse name="其他信息" id="outside10" :maxHeight="maxHeight10">
				<view class="listdefault" :id="uId10">
					<view class="action">
						<view class="list1">备注</view>
						<view class="list2">{{ detailData.bz }}</view>
					</view>
					<view class="action">
						<view class="list1">邮寄信息</view>
						<view class="list2">{{ detailData.yjxx }}</view>
					</view>
					<view class="action" v-if="detailData.lx == '2'">
						<view class="list1">变更说明</view>
						<view class="list2">{{ detailData.contractChangeReason }}</view>
					</view>
					<view class="action">
						<view class="list1">收入确认方式</view>
						<view class="list2">{{ detailData.confirmIncomeMethod_dictText }}</view>
					</view>
				</view>
			</collapse>
			<default-list name="合同原件" v-if="!detailData.sfyz || detailData.sfyz != 1">
				<file-list :fileList="detailData.masterCopy"></file-list>
			</default-list>
			<default-list name="用印文件" v-if="detailData.sfyz && detailData.sfyz == 1">
				<file-list :fileList="detailData.signFile"></file-list>
			</default-list>
			<default-list name="相关附件">
				<file-list :fileList="detailData.xgfj"></file-list>
			</default-list>
			<default-list name="流程图" id="outside6">
				<template slot="right">
					<view class="flow_right" @click="flowView">
						<image src="../../static/synergy/viewflow.png" mode="aspectFill"></image>
						<text>流程图</text>
					</view>
				</template>
				<flow-list :dataSource="resultList"></flow-list>
			</default-list>
		</view>
		<view class="task_bottom" v-if="tabvalue == '待办'">
			<view class="task_bottom_write" @click="approval">
				<image src="../../static/synergy/write_commont.png" mode="aspectFill"></image>
				<text>审批</text>
			</view>
			<view class="refuse" @click="refuseProcess" v-if="nodeObj.isSubmit !== '1'">退回</view>
			<view class="agree" @click="agreeProcess" :style="{flex: nodeObj.isSubmit == '1'?1:'initial',margin: nodeObj.isSubmit == '1'?'0 20rpx':''}">同意</view>
		</view>
		<u-toast ref="uToast"></u-toast>
		<u-popup mode="bottom" :show="showFormModalC" :closeOnClickOverlay="false">
		  <FormC
				ref="dataFormC"
				:index="index"
				:htlx="detailData.htlx"
				:projectId="detailData.xmmc"
				@close="closeFormModalC"
			/>
		</u-popup>
	</view>
</template>
<script>
	import actionCollapse from './components/actionCollapse.vue'
	import detailInformationList from './components/detailInformationList.vue'
	import fileList from './components/fileList.vue'
	import collapse from './components/collapse.vue'
	import defaultList from './components/defaultList.vue'
	import flowList from './components/flowList.vue'
	import FormC from './components/FormC.vue'
	import http from '@/utils/request/index'
	import {
		queryByIdContractManager, // 根据id查询信息
		getProcessTaskTransInfo, // 查询流程流转信息
		getProcessHistoryList, // 查询流程图信息
		getProcessHistoryTaskList, // 查询历史流程图信息
		getNodePositionInfo, // 查询坐标信息数据
		rejectProcess, // 退回
		processComplete ,// 提交完成
		getChildrenListEntrust, // 委托方信息子表
		getChildrenListTrustee, // 受托方信息子表
		getChildrenListClass, // 任务信息子表
		getChildrenListPlan, // 收款计划子表
	} from '@/api/index.js'
	import {
		BASE_URL
	} from '@/utils/baseUrl.js'
	export default {
		data() {
			return {
				basicFormC: {},
				showFormModalC: false,
				index: null,
				tabsList: [
					{ name: '基本信息',id: 'outside1' },
					{ name: '委托方(合同甲方)信息',id: 'outside2' }, 
					{ name: '受托方(合同乙方)信息',id: 'outside3' },
					{ name: '收付款计划',id: 'outside5' },
					{ name: '任务信息',id: 'outside4' },
					{ name: '合同税率',id: 'outside9' },
					{ name: '流程',id: 'outside6' },
				],
				detailData: {}, // 详情数据
				basicInfo: { // 主表信息字段
					'单据编号': 'htbh',
					'申请时间': 'createTime',
					'申请人': 'proposer_dictText',
					'申请部门': 'proposerDeptId_dictText',
				},
				childFields2: {
					'名称': 'gsdaId_dictText',
					'是否为付款单位': 'isFk_dictText',
				}, // 子表字段
				childFields3: {
					'名称': 'khdaId_dictText',
					'是否为收款单位': 'isSk_dictText',
				}, // 子表字段
				childFields4: {
					'业务编码': 'ywfl',
					'业务名称': 'ywmc',
					'合同占比(%)': 'htzb',
					'分配合同额(元)': 'fphte',
					'切割合同额(元)': 'cutContractAmount',
					'生产团队': 'sctd_dictText',
					// '生产公司': 'productCompanyId',
					'团队负责人': 'tdfzr_dictText',
				}, // 任务信息子表字段
				childFields5: {
					'款项类型': 'contractPaymentType_dictText',
					'款项名称': 'kxmc',
					'金额(元)': 'je',
					'预计款项日期': 'kxrq',
					'款项节点说明': 'kxjdsm',
					'款项关联任务': 'taskId_dictText',
					'应收状态': 'collectMoneyStatus',
					// '款项节点说明': 'kxjdsm',
				}, // 收付款计划子表字段
				/* 合同税率 */
				childFields9: {
					'含税金额(元)': 'amount',
					'税率(%)': 'taxRate_dictText',
					'税额(元)': 'taxation',
					'未税金额(元)': 'untaxedAmount',
					'备注': 'remark'
				},
				resultList: [], // 流程图数据
				nodePositionInfo: {}, // 坐标信息
				processInstanceId: '',
				scrollTop: 0, // 滚动顶部距离
				model: {}, // 处理单据表信息
				resultObj: {}, // 流程图流转信息
				nodeObj: {}, // 流程节点信息
				tabvalue: '', // 协同首页tabs name
				contactList: [], // 合同附件信息
				childSource2: [], // 委托方信息子表数据
				childSource3: [], // 受托方信息子表数据
				childSource4: [], // 任务信息子表数据
				childSource5: [], // 收付款计划子表数据
				childSource9: [], // 合同税率
				isClick: false,
				maxHeight: 0,
				maxHeight7: 0,
				maxHeight8: 0,
				maxHeight10: 0,
				uId: uni.$u.guid(),
				uId7: uni.$u.guid(),
				uId8: uni.$u.guid(),
				uId10: uni.$u.guid()
			}
		},
		components: {
			actionCollapse,
			detailInformationList,
			fileList,
			collapse,
			defaultList,
			flowList,
			FormC
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop;
		},
		onReady() {
			uni.setNavigationBarTitle({
				title: this.model.bpmBizTitle.replace(/(【|】)/g,'')
			});
		},
		onLoad(options) {
			this.model = JSON.parse(decodeURIComponent(options.item))
			var that = this
			var eventChannel = ''
			// #ifdef APP-NVUE
				eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE
			// #endif
			// #ifndef APP-NVUE
				eventChannel = this.getOpenerEventChannel();
			// #endif
			// 监听sendMessage事件，获取上一页面通过eventChannel传送到当前页面的数据
			eventChannel.on('sendMessage', function(data) {
				that.tabvalue = data.tabvalue
				
				that.nodeObj = JSON.parse(decodeURIComponent(data.nodeObj))
				that.loadData(that.nodeObj.dataId)
				that.getNodePositionInfoData(that.model.processInstanceId)
				if (that.tabvalue == '待办') {
					that.getProcessTaskTrans(that.model.id)
				}
				// that.initDictConfig()
			})
		},
		methods: {
			// 点击进入审批页面
			approval(){
				if(this.isClick){
					return
				}
				var that = this
				var nextnode = ''
				if(this.resultObj.transitionList){
					this.resultObj.transitionList.forEach(item => {
						nextnode += ',' + item.nextnode
					})
				}
				uni.navigateTo({
					url:'/pages/synergy/approval',
					success: function(res) {
						// 通过eventChannel向被打开页面传送数据
						res.eventChannel.emit('acceptDataFromOpenerPage', {
							nodeObj: encodeURIComponent(JSON.stringify(that.nodeObj).replace(/%/g, '%25')),
							resultObj: encodeURIComponent(JSON.stringify(that.resultObj).replace(/%/g, '%25')),
							model: encodeURIComponent(JSON.stringify(that.model).replace(/%/g, '%25')),
							nextnode: nextnode
						})
					}
				})
			},
			// 查询流程流转信息 -- 获取下一节点信息
			getProcessTaskTrans(taskId){
				getProcessTaskTransInfo({ taskId }).then(res => {
					if(res.success){
						this.resultObj = res.result
					} else {
						this.$refs.uToast.show({
							message: res.message,
							type: 'error'
						})
					}
				}).catch(err => {
					console.log(err);
				})
			},
			// 查询预立项申请详情
			async loadData(id){
				queryByIdContractManager({ id }).then(async res => {
					if(res.success){
						this.detailData = res.result
						if (res.result.sfyz && res.result.sfyz == 1 && res.result.signSealWay == 'online') {
							this.childFields3 = {
								'名称': 'khdaId_dictText',
								'是否为付款单位': 'isFk_dictText',
								'对方是否为电子签章': 'isSignSeal_dictText',
								'对方盖章人': 'psnName',
								'联系方式': 'psnMobile'
							}
							this.childFields2 = {
								'名称': 'gsdaId_dictText',
								'是否为收款单位': 'isSk_dictText',
								'我方经办人': 'psnName',
								'联系方式': 'psnMobile'
							}
						} else {
							this.childFields3 = {
								'名称': 'khdaId_dictText',
								'是否为付款单位': 'isFk_dictText',
							}
							this.childFields2 = {
								'名称': 'gsdaId_dictText',
								'是否为收款单位': 'isSk_dictText',
							}
						}
						this.getChildrenPlan(getChildrenListPlan,'childSource5',res.result.id) // 收款计划子表
						this.getChildren(getChildrenListTrustee,'childSource3',res.result.id) // 受托方信息子表
						this.getChildren(getChildrenListEntrust,'childSource2',res.result.id) // 委托方信息子表
						this.getRateChildren('childSource9',res.result.id) // 合同税率
						this.getChildren(getChildrenListClass,'childSource4',res.result.id) // 任务信息子表
						this.timer = setTimeout(() => {
							clearTimeout(this.timer)
							this.timer = null
							this.$nextTick(() => {
								uni.createSelectorQuery().select('#'+this.uId).boundingClientRect(data => {
									this.maxHeight = data.height
								}).exec();
								uni.createSelectorQuery().select('#'+this.uId7).boundingClientRect(data => {
									this.maxHeight7 = data.height
								}).exec();
								uni.createSelectorQuery().select('#'+this.uId8).boundingClientRect(data => {
									this.maxHeight8 = data.height
								}).exec();
								uni.createSelectorQuery().select('#'+this.uId10).boundingClientRect(data => {
									this.maxHeight10 = data.height
								}).exec();
							})
						}, 300)
					} else {
						this.$refs.uToast.show({
							message: res.message,
							type: 'error'
						})
					}
				})
			},
			// 获取子表数据
			getChildren(promiseUrl,key,id){
				var params = { mainId: id }
				promiseUrl(params).then(res => {
					if (res.success) {
						this[key]= res.result.records || res.result
					} else {
						this.$refs.uToast.show({
							message: res.message,
							type: 'error'
						})
					}
				})
			},
			// 获取收付款计划子表数据
			async getChildrenPlan(promiseUrl,key,id){
				var params = { mainId: id }
				promiseUrl(params).then(res => {
					if (res.success) {
						res.result.map((value, index) => {
							res.result[index].taskId_dictText = '' // 首先款项关联任务字段默认为空
							// 遍历planTaskList数组赋值给taskId_dictText
							res.result[index].taskId_dictText = value.planTaskList && value.planTaskList.length ? (value.planTaskList.map((obj)=>{return obj.categoryName }).join(",")):'';
						})
						this[key]= res.result.records || res.result
					} else {
						this.$refs.uToast.show({
							message: res.message,
							type: 'error'
						})
					}
				})
			},
			// 获取合同税率
			getRateChildren(key,id){
				let params = {
					contractId: id,
					pageNo: 1,
					pageSize: -1
				}
				http.get('/api/erp/omc/contractmanager/erpOmcContractRate/list', params).then(res => {
					if (res.success) {
						this[key]= res.result.records || res.result
					} else {
						this.$refs.uToast.show({
							message: res.message,
							type: 'error'
						})
					}
				})
			},
			handleClick (value, index) {
				// 展示绑定的任务信息
				this.basicFormC = { ...value }
				this.index = index
				this.showFormModalC = true
				this.$nextTick(() => {
					this.openFormModalC()
				})
			},
			openFormModalC() {
			  this.$refs.dataFormC.basicForm = Object.assign({},this.basicFormC)
			  this.$refs.dataFormC.formDataC = this.basicFormC.planTaskList || []
			},
			closeFormModalC () {
				this.$refs.dataFormC.reset()
				this.basicFormC = {}
				this.index = null
				this.showFormModalC = false
			},
			// 查询流程节点信息 -- 流程图数据
			getProcessHistoryListS(processInstanceId){
				var url = ''
				var params = ''
				url = getProcessHistoryList
				params = {
					processInstanceId: processInstanceId
				}
				
				url(params).then((res)=>{
					if(res.success){
						this.resultList = res.result.records;
					} else {
						this.$refs.uToast.show({
							message: res.message,
							type: 'error'
						})
					}
				})
			},
			// 查询坐标信息数据 -- 流程图备注
			getNodePositionInfoData(processInstanceId) {
				getNodePositionInfo({ processInstanceId }).then(res => {
					if (res.success) {
						this.nodePositionInfo = res.result
						this.getProcessHistoryListS(processInstanceId)
					} else {
						this.$refs.uToast.show({
							message: res.message,
							type: 'error'
						})
					}
				}).catch(e => {
					console.error(e)
				})
			},
			// 流程图预览
			flowView(){
				var params = `_t=${Date.parse(new Date()) / 1000}&processInstanceId=${this.model.processInstanceId}`
				var url = `${BASE_URL}/api/erpmng/act/task/traceImage?${params}`
				this.viewImage(url)
			},
			// 预览图片
			viewImage(url){
				uni.previewImage({
					urls: [url],
					longPressActions: {
						itemList: ['保存图片'],
						success: function(data) {
							uni.downloadFile({
								url: url,
								success: (result) => {
									if (result.statusCode === 200) {
										//文件保存到本地
										uni.saveFile({
											tempFilePath: result.tempFilePath, //临时路径
											success: function(ress) {
												uni.showToast({
													icon: 'none',
													mask: true,
													title: '文件已保存：' + ress.savedFilePath, //保存路径
													duration: 3000,
												});
											}
										});
									}
								},
								fail: (err) => {
									uni.showToast({
										icon: 'none',
										mask: true,
										title: '失败请重新下载',
									});
								}
							})
						},
						fail: function(err) {
							console.log(err.errMsg);
						}
					}
				})
			},
			// 点击tabs
			onTabClick (item) {
				uni.createSelectorQuery().in(this).select(`#${item.id}`).boundingClientRect(data => {
					uni.pageScrollTo({
						scrollTop:data.top + this.scrollTop - 54,
						duration: 150
					})
				 }).exec();
			},
			// 拒绝流程
			refuseProcess(){
				var that = this
				var nextnode = ''
				if(this.resultObj.transitionList){
					this.resultObj.transitionList.forEach(item => {
						nextnode += ',' + item.nextnode
					})
				}
				uni.navigateTo({
					url:'/pages/synergy/approval',
					success: function(res) {
						// 通过eventChannel向被打开页面传送数据
						res.eventChannel.emit('acceptDataFromOpenerPage', {
							nodeObj: encodeURIComponent(JSON.stringify(that.nodeObj).replace(/%/g, '%25')),
							model: encodeURIComponent(JSON.stringify(that.model).replace(/%/g, '%25')),
							resultObj: encodeURIComponent(JSON.stringify(that.resultObj).replace(/%/g, '%25')),
							nextnode: nextnode,
							noAgree: '1'
							
						})
					}
				})
			},
			// 同意流程
			agreeProcess(){
				if(this.isClick){
					this.$refs.uToast.show({
						message: '请勿重复点击！',
						type: 'default'
					})
					return
				}
				var nextnode = ''
				if(this.resultObj.transitionList){
					this.resultObj.transitionList.forEach(item => {
						nextnode += ',' + item.nextnode
					})
				}
				this.isClick = true
				
				var _this = this
				uni.showModal({
					content: '该任务将同意审批，是否继续？',
					cancelText: '否',
					confirmText: '是',
					confirmColor: '#576B95',
					cancelColor: '#000000',
					success: function (res) {
						if (res.confirm) {
							
							var params = {
								bizTaskList: "[]",
								ccUserIds: "",
								ccUserRealNames: "",
								fileList: "[]",
								isSubmit: _this.nodeObj.isSubmit,
								method: "post",
								nextCodeCount: "",
								nextUserId: "",
								nextUserName: "",
								nextnode: nextnode?nextnode.substring(1):'',
								procInsId: _this.model.processInstanceId,
								processModel: 1,
								reason: "同意",
								rejectModelNode: "",
								taskId: _this.model.id,
							}
							processComplete(params).then(res => {
								_this.$refs.uToast.show({
									message: res.message,
									type: res.success?'success':'error',
									duration: 1000,
									complete() {
										if(res.success) uni.switchTab({url: '/pages/synergy/synergy'});
										_this.isClick = false
									}
								})
							}).catch(err => {
								_this.isClick = false
							})
						} else if (res.cancel) {
							_this.show = false
							_this.isClick = false
						}
					}
				});
			}
		}
	}
</script>
<style lang="scss" scoped>
@import "./common/action.scss";
.task_lists{
	padding: 20rpx 20rpx 0;
}

.flow_right{
	display: flex;
	align-items: center;
	image{
		width: 40rpx;
		height: 40rpx;
	}
	text{
		font-size: 14px;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #1E6FFF;
		line-height: 40rpx;
		margin-left: 4rpx;
	}
}

.task_bottom{
	display: flex;
	align-items: center;
	padding: 20rpx 0 20rpx 52rpx;
	background-color: #FFFFFF;
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 10000;
	.task_bottom_write{
		display: flex;
		align-items: center;
		image{
			width: 48rpx;
			height: 48rpx;
			margin-right: 8rpx;
		}
		text{
			font-size: 28rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #7F7F7F;
			line-height: 40rpx;
		}
	}
	.refuse{
		width: 168rpx;
		height: 90rpx;
		line-height: 90rpx;
		background: rgba(0,0,0,0.0500);
		border-radius: 10rpx;
		margin: 0 16rpx 0 52rpx;
		font-size: 34rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: rgba(0,0,0,0.5000);
		text-align: center;
	}
	.agree{
		width: 318rpx;
		height: 90rpx;
		line-height: 90rpx;
		background: #1E6FFF;
		border-radius: 10rpx;
		font-size: 34rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		text-align: center;
	}
}
</style>
